package com.machine.filling.ui.dialog;

import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StyleRes;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.machine.filling.R;

/**
 * Created by Administrator on 2018/2/19 0019.
 */

public class ListDialog extends Dialog {
    private Context mContext;
    private RecyclerView recyclerview;
    private TextView tv_title;

    public ListDialog(@NonNull Context context) {
        this(context, R.style.Translucent_NoTitle);
        this.mContext = context;
        initView();
    }

    public ListDialog(@NonNull Context context, @StyleRes int themeResId) {
        super(context, themeResId);
    }

    private void initView() {
        View view = View.inflate(mContext,R.layout.dialog_content_list,null);
        setContentView(view);
        tv_title = (TextView) view.findViewById(R.id.tv_title);
        recyclerview = (RecyclerView) view.findViewById(R.id.recyclerview);
        recyclerview.setLayoutManager(new LinearLayoutManager(mContext,LinearLayoutManager.VERTICAL,false));
    }
    public void setListTitle(String title){
        tv_title.setText(title);
    }
    public void setAdapter(RecyclerView.Adapter adapter){
        recyclerview.setAdapter(adapter);
    }
}
